package com.adms.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.adms.domain.CountMapper;

@RequestMapping("count")
@RestController
public class CountController {

	@Autowired
	private CountMapper countMapper;
	
	//整改状态及数量统计
	@GetMapping("count1")
	public Object count1(Integer year,Integer month) {
		return countMapper.count1(year,month);
	}
	
	//整改数量按年或月统计
	@GetMapping("count2")
	public Object count2(Integer year,Integer month) {
		return countMapper.count2(year,month);
	}
	
	//以网格为单位的整改统计
	@GetMapping("count3")
	public Object count3(Integer year,Integer month) {
		return countMapper.count3(year,month);
	}

	
	// 通知统计
	@GetMapping("count4")
	public Object count4(Integer year,Integer month) {
		return countMapper.count4(year,month);
	}
	
	// 人员分析
	@GetMapping("count5")
	public Object count5() {
		return countMapper.count5();
	}
	
	// 工地企业统计
	@GetMapping("count6")
	public Object count6() {
		return countMapper.count6();
	}
	
	// 工地企业按网格统计
	@GetMapping("count7")
	public Object count7() {
		return countMapper.count7();
	}
	
	//按照整改事项类型统计数量
	@GetMapping("count8")
	public Object count8(Integer year,Integer month) {
		return countMapper.count8(year,month);
	}
	
	//按时间段统计各个网格的未完成和已完成整改
	@GetMapping("count9")
	public Object count9(Integer year,Integer month) {
		return countMapper.count9(year,month);
	}
	
	//各个网格整改超时统计
	@GetMapping("count10")
	public Object count10() {
		return countMapper.count10();
	}
	
	@GetMapping("count11")
	public Object count11(Integer year,Integer month) {
		return countMapper.count11(year,month);
	}
	
	
	@GetMapping("ex")
	public Object ex(@RequestParam Integer year,Integer month) {
		List<Map<String, Object>> ex1 = countMapper.ex1(year,month);
		List<Map<String, Object>> ex2 = countMapper.ex2(year,month);
		List<Map<String, Object>> ex3 = countMapper.ex3(year,month);
		for(int i = 0;i < ex1.size();i++) {
			ex1.get(i).putAll(ex2.get(i));
			ex1.get(i).putAll(ex3.get(i));
		}
		return ex1;
	}
}
